package com.xyd.Biz.Impl;

import com.xyd.Biz.NewsBiz;
import com.xyd.Dao.NewsDao;
import com.xyd.Entity.News;
import com.xyd.Util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class NewsBizImpl implements NewsBiz {
    SqlSession sqlSession =null;
    NewsDao newsDao = null;

    public NewsBizImpl(){
        sqlSession = SqlSessionFactoryUtil.open();
        newsDao = sqlSession.getMapper(NewsDao.class);
    }

    @Override
    public List<News> selectannouncements(int id) {
        return newsDao.selectannouncements(id);
    }

    @Override
    public List<News> selectNews(int id) {
        return newsDao.selectNews(id);
    }

    @Override
    public News selectbyId(int id) {
        return newsDao.selectbyId(id);
    }

    @Override
    public int updateNews(News news) {
        return newsDao.updateNews(news);
    }

    @Override
    public List<News> selectAllNews() {
        return newsDao.selectAllNews();
    }

    @Override
    public int insertNews(News news) {
        return newsDao.insertNews(news);
    }

    @Override
    public int deleteNews(int id) {
        return newsDao.deleteNews(id);
    }

    @Override
    public int selecttypecount(int type) {
        return newsDao.selecttypecount(type);
    }
}
